// stores/counter.js
import { defineStore } from 'pinia';
import { ref } from 'vue'
import uniStorage from './uniStorage.js'

export const useCounterStore = defineStore('counter', ()=>{
	const count=ref(0)
	function increment(){
		count.value++
	}
	return {count,increment}
},{
	persist: {
	  enabled: true,
	  strategies: [
	    {
	      key: 'counter-store',
	      storage: uniStorage, // localStorage、uniStorage、sessionStorage 等
	      paths: ['count'] // 只持久化 count
	    }
	  ]
	}
});
